VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{B3FB64BF-91F9-11D7-A482-0008A14158BC}#2.22#0"; "ITGControls.ocx"
Begin VB.Form frmBasicGLFixedAssetDep 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   6750
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   11565
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MDIChild        =   -1  'True
   ScaleHeight     =   6750
   ScaleWidth      =   11565
   ShowInTaskbar   =   0   'False
   Begin MSComctlLib.StatusBar sbRS 
      Align           =   2  'Align Bottom
      Height          =   285
      Left            =   0
      TabIndex        =   7
      Top             =   6465
      Width           =   11565
      _ExtentX        =   20399
      _ExtentY        =   503
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   5
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
         BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Alignment       =   1
            AutoSize        =   1
            Bevel           =   0
            Object.Width           =   7172
            MinWidth        =   2
         EndProperty
         BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
         BeginProperty Panel5 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
            Object.Width           =   3528
            MinWidth        =   3528
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin ITGControls.ITGTab SSTab1 
      Height          =   3375
      Left            =   30
      TabIndex        =   8
      Top             =   30
      Width           =   11205
      _ExtentX        =   19764
      _ExtentY        =   5953
      TabCount        =   2
      TabCaption(0)   =   "               Main               "
      TabContCtrlCnt(0)=   1
      Tab(0)ContCtrlCap(1)=   "ComunionFrames1"
      TabCaption(1)   =   "               List               "
      TabContCtrlCnt(1)=   1
      Tab(1)ContCtrlCap(1)=   "dtgList"
      TabTheme        =   2
      ActiveTabBackStartColor=   16250865
      ActiveTabBackEndColor=   16243138
      InActiveTabBackStartColor=   16243138
      InActiveTabBackEndColor=   16243138
      InActiveTabForeColor=   0
      BeginProperty ActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty InActiveTabFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      OuterBorderColor=   4210752
      TopLeftInnerBorderColor=   4210752
      BottomRightInnerBorderColor=   4210752
      DisabledTabBackColor=   16243138
      DisabledTabForeColor=   -2147483630
      Begin MSDataGridLib.DataGrid dtgList 
         Height          =   2580
         Left            =   -75000
         TabIndex        =   6
         Top             =   315
         Width           =   11205
         _ExtentX        =   19764
         _ExtentY        =   4551
         _Version        =   393216
         AllowUpdate     =   0   'False
         AllowArrows     =   -1  'True
         Appearance      =   0
         HeadLines       =   1
         RowHeight       =   15
         TabAction       =   2
         FormatLocked    =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   4
         BeginProperty Column00 
            DataField       =   "cTranNo"
            Caption         =   "Transaction No."
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "dDate"
            Caption         =   "Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   3
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "dFromDate"
            Caption         =   "Date From"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "MM/dd/yyyy"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "dToDate"
            Caption         =   "To Date"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            AllowRowSizing  =   0   'False
            BeginProperty Column00 
               ColumnAllowSizing=   -1  'True
               Locked          =   -1  'True
               ColumnWidth     =   1649.764
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   1454.74
            EndProperty
            BeginProperty Column02 
               Locked          =   -1  'True
               ColumnWidth     =   1200.189
            EndProperty
            BeginProperty Column03 
               Object.Visible         =   -1  'True
            EndProperty
         EndProperty
      End
      Begin ITGControls.ComunionFrames ComunionFrames1 
         Height          =   3060
         Left            =   0
         Top             =   315
         Width           =   11205
         _ExtentX        =   19764
         _ExtentY        =   5398
         FrameColor      =   4210752
         BackColor       =   16243138
         FillColor       =   16243138
         RoundedCorner   =   0   'False
         Caption         =   "Transaction Information"
         Alignment       =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ThemeColor      =   5
         ColorFrom       =   16243138
         ColorTo         =   16250865
         Begin VB.CommandButton cmdPickWork 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2760
            Picture         =   "frmBasicGLFixedAssetDep.frx":0000
            Style           =   1  'Graphical
            TabIndex        =   17
            Top             =   2640
            Width           =   315
         End
         Begin VB.CommandButton cmdPickProject 
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   300
            Left            =   2760
            Picture         =   "frmBasicGLFixedAssetDep.frx":014A
            Style           =   1  'Graphical
            TabIndex        =   14
            Top             =   2280
            Width           =   315
         End
         Begin VB.Timer Timer1 
            Interval        =   300
            Left            =   3480
            Top             =   525
         End
         Begin ITGControls.ITGTextBox txtcTranNo 
            Height          =   285
            Left            =   165
            TabIndex        =   0
            Top             =   555
            Width           =   2590
            _ExtentX        =   4366
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Transaction No."
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1285
            Required        =   -1  'True
         End
         Begin ITGControls.ITGDateBox dtbDate 
            Height          =   285
            Left            =   6495
            TabIndex        =   1
            Tag             =   "Transaction Date"
            Top             =   555
            Width           =   1305
            _ExtentX        =   2302
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
            Mandatory       =   -1  'True
         End
         Begin ITGControls.ITGDateBox dtbTo 
            Height          =   285
            Left            =   1440
            TabIndex        =   3
            Tag             =   "Date Needed"
            Top             =   1185
            Width           =   1320
            _ExtentX        =   2328
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
         End
         Begin ITGControls.ITGDateBox dtbFrom 
            Height          =   285
            Left            =   1440
            TabIndex        =   2
            Tag             =   "Date Needed"
            Top             =   870
            Width           =   1320
            _ExtentX        =   2328
            _ExtentY        =   503
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Text            =   ""
            SendKeysTab     =   -1  'True
         End
         Begin RichTextLib.RichTextBox txtRemarks 
            Height          =   735
            Left            =   1440
            TabIndex        =   4
            Top             =   1505
            Width           =   6300
            _ExtentX        =   11113
            _ExtentY        =   1296
            _Version        =   393217
            ScrollBars      =   2
            MaxLength       =   500
            Appearance      =   0
            TextRTF         =   $"frmBasicGLFixedAssetDep.frx":0294
         End
         Begin ITGControls.ITGTextBox txtcRemarks 
            Height          =   285
            Left            =   1920
            TabIndex        =   13
            Top             =   1770
            Width           =   3495
            _ExtentX        =   5953
            _ExtentY        =   503
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            TextBoxWidth    =   1935
         End
         Begin ITGControls.ITGTextBox txtProject 
            Height          =   285
            Left            =   165
            TabIndex        =   15
            Top             =   2280
            Width           =   2490
            _ExtentX        =   4180
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Project"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1180
            Required        =   -1  'True
            LinkForeColor   =   16711680
         End
         Begin ITGControls.ITGTextBox txtProjectName 
            Height          =   285
            Left            =   3105
            TabIndex        =   16
            Top             =   2280
            Width           =   4365
            _ExtentX        =   7594
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   4305
            Enabled         =   0   'False
         End
         Begin ITGControls.ITGTextBox txtWork 
            Height          =   285
            Left            =   165
            TabIndex        =   18
            Top             =   2640
            Width           =   2490
            _ExtentX        =   4180
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14745599
            LabelBackColor  =   16243138
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Mandatory       =   -1  'True
            Label           =   "Work"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   1250
            TextBoxWidth    =   1180
            Required        =   -1  'True
            LinkForeColor   =   16711680
         End
         Begin ITGControls.ITGTextBox txtWorkDesc 
            Height          =   285
            Left            =   3105
            TabIndex        =   19
            Top             =   2640
            Width           =   4365
            _ExtentX        =   7594
            _ExtentY        =   503
            SendKeysTab     =   -1  'True
            BackColor       =   14737632
            BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            AllCaps         =   -1  'True
            Label           =   "ITGtext"
            BeginProperty LabelFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
               Name            =   "Tahoma"
               Size            =   8.25
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            LabelWidth      =   0
            TextBoxWidth    =   4305
            Enabled         =   0   'False
         End
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Remarks"
            Height          =   195
            Left            =   600
            TabIndex        =   12
            Top             =   1530
            Width           =   615
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "To Date"
            Height          =   195
            Left            =   660
            TabIndex        =   11
            Top             =   1215
            Width           =   570
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "From Date"
            Height          =   195
            Left            =   495
            TabIndex        =   10
            Top             =   900
            Width           =   750
         End
         Begin VB.Label Label1 
            AutoSize        =   -1  'True
            BackStyle       =   0  'Transparent
            Caption         =   "Date"
            Height          =   195
            Left            =   6030
            TabIndex        =   9
            Top             =   600
            Width           =   345
         End
      End
   End
   Begin ITGControls.ComunionFrames ComunionFrames2 
      Height          =   3000
      Left            =   30
      Top             =   3390
      Width           =   11205
      _ExtentX        =   19764
      _ExtentY        =   5292
      FrameColor      =   4210752
      BackColor       =   16243138
      FillColor       =   16243138
      RoundedCorner   =   0   'False
      Caption         =   "Details"
      Alignment       =   0
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ThemeColor      =   5
      ColorFrom       =   16243138
      ColorTo         =   16250865
      Begin MSDataGridLib.DataGrid dtgFixedAsset 
         Height          =   2580
         Left            =   0
         TabIndex        =   5
         Top             =   420
         Width           =   11205
         _ExtentX        =   19764
         _ExtentY        =   4551
         _Version        =   393216
         AllowUpdate     =   -1  'True
         AllowArrows     =   -1  'True
         BackColor       =   16777215
         HeadLines       =   1
         RowHeight       =   15
         TabAcrossSplits =   -1  'True
         TabAction       =   2
         FormatLocked    =   -1  'True
         AllowDelete     =   -1  'True
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ColumnCount     =   6
         BeginProperty Column00 
            DataField       =   "cAssetID"
            Caption         =   "Asset ID"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column01 
            DataField       =   "cDesc"
            Caption         =   "Description"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column02 
            DataField       =   "nMoDepreciation"
            Caption         =   "Mo. Depreciation"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   1
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   1
            EndProperty
         EndProperty
         BeginProperty Column03 
            DataField       =   "cDepreAcct"
            Caption         =   "Depre. Account"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column04 
            DataField       =   "cExpAcct"
            Caption         =   "Expense Account"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   "#,##0.00"
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         BeginProperty Column05 
            DataField       =   "cRemarks"
            Caption         =   "Remarks"
            BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
               Type            =   0
               Format          =   ""
               HaveTrueFalseNull=   0
               FirstDayOfWeek  =   0
               FirstWeekOfYear =   0
               LCID            =   1033
               SubFormatType   =   0
            EndProperty
         EndProperty
         SplitCount      =   1
         BeginProperty Split0 
            BeginProperty Column00 
               Locked          =   -1  'True
               ColumnWidth     =   1275.024
            EndProperty
            BeginProperty Column01 
               Locked          =   -1  'True
               ColumnWidth     =   2489.953
            EndProperty
            BeginProperty Column02 
               Alignment       =   1
               ColumnWidth     =   1395.213
            EndProperty
            BeginProperty Column03 
               Locked          =   -1  'True
               ColumnWidth     =   1365.165
            EndProperty
            BeginProperty Column04 
               Locked          =   -1  'True
               ColumnWidth     =   1425.26
            EndProperty
            BeginProperty Column05 
               ColumnWidth     =   3075.024
            EndProperty
         EndProperty
      End
   End
End
Attribute VB_Name = "frmBasicGLFixedAssetDep"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private oPrint As New clsPrinting

Private AutoNum As New clsAutoNumber '---Added
Public MenuName As String '---Added

Private connHeader As ADODB.Connection
Private connDetail As ADODB.Connection

Private WithEvents rsHeader As ADODB.Recordset
Attribute rsHeader.VB_VarHelpID = -1
Private rsDetail As ADODB.Recordset

Enum eBasicFADescMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eBasicFADescMode

Public dtgName As String
Public sBit As String
Private vBM As Variant

Private lSystemGenerated As Boolean
Public strNo As String

Public lACNew As Boolean
Public lACEdit As Boolean
Public lACDelete As Boolean
Public lACPost As Boolean
Public lACCancel As Boolean
Public lACPrint As Boolean
Private lSysTransDate As Boolean 'add by denz:2/17/2011 for transdate
Private Sub dtgFixedAsset_Click()
    If Mode = AddNewEdit Then dtgName = dtgFixedAsset.Name
End Sub

Private Sub dtgFixedAsset_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub dtgFixedAsset_GotFocus()
    dtgName = dtgFixedAsset.Name
End Sub

Private Sub dtgFixedAsset_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii))) 'All Upper Case String
End Sub

Private Sub dtgFixedAsset_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Mode <> AddNewEdit Then Exit Sub
    If Button = 2 Then
        dtgName = dtgFixedAsset.Name
        PopupMenu ITGLedgerMain.mnuDetail
    End If
End Sub

Private Sub dtgList_HeadClick(ByVal ColIndex As Integer)
    SortGrid dtgList, ColIndex, rsHeader
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Dim iKey As Integer
    iKey = ToolbarIndex(KeyCode, Shift)
    If iKey <> 0 Then
        If ITGLedgerMain.tbrMain.Buttons(iKey).Enabled = True Then
            ToolbarFunction iKey
        End If
    End If
End Sub

Private Sub Form_Load()

    Set FrmName = Me
    FormSetup

    AcessBit Me, GetValueFrTable("AccessLevel", "SEC_ACCESSLEVEL", "RoleID = '" & SecUserRole & "' AND [Module] = 'BGL03'")
    
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset
    
    FormLocking True
    FormSearch True
    SearchObj True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    
    Mode = Find
    txtcTranNo.Locked = False
   
End Sub

Private Sub Form_Activate()
    TBBitReload
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    If Mode = AddNewEdit Then
        MsgBox "Unable to close. You are in Add/New/Edit mode." & vbCr & _
            " Must Save or Undo", vbCritical, Me.Caption
        Cancel = True
        Exit Sub
    End If

    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False


    Set oPrint = Nothing
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set connHeader = Nothing
    Set connDetail = Nothing

    Set frmBasicGLFixedAssetDep = Nothing

    lCloseWindow = True
    
    'oForm(Me.Tag).Mode = 1
    'oForm(Me.Tag).Tag = Me.Tag
End Sub

Public Sub TBNew()

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    txtcTranNo.BackColor = &HE0FFFF
    Mode = AddNewEdit

    If rsHeader.State <> adStateOpen Then
        OpenNewConnection connHeader
        OpenNewConnection connDetail
        OpenRecordsetWithCN rsDetail, "*", "FIXEDASSETDEPRE_T", connDetail, "WHERE 1 = 0"
        OpenRecordsetWithCN rsHeader, "*", "FIXEDASSETDEPRE", connHeader, "WHERE 1 = 0"
        SetDataSource
        SetDataField
    Else
        vBM = rsHeader.Bookmark
    End If

    rsHeader.AddNew
    rsHeader!cCompanyID = COID
    rsHeader!dDate = Date

    
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    SSTab1.ActiveTab = 0
    txtcTranNo.SetFocus
    txtcTranNo.Locked = True
    
    MenuName = "AUTO_NUMBER_FAD"
    lSystemGenerated = GetValueFrTable("lAutoNo", "system_autonumber", "cCode = '" & MenuName & "' ")
    If lSystemGenerated Then rsHeader!cTranNo = AutoNum.Generate_CtrlNo2(MenuName, Format(Now, "mm/dd/yyyy"))
    
    strNo = rsHeader!cTranNo
End Sub

'Undo all changes to the recordset
Public Sub TBUndoAll()
On Error GoTo ErrorHandler

    Mode = Normal
    
    If rsHeader.Status = adRecNew Then TBUndoCurrent
    
    rsHeader.CancelBatch adAffectAll
    rsDetail.CancelBatch adAffectAll
    
    UnbindControls
    
    If rsHeader.RecordCount <> 0 Then rsHeader.Bookmark = vBM
    
    Set FrmName = Me
    FormLocking True
    
    If rsHeader.RecordCount <> 0 Then
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , lACDelete, , , , lACCancel, , , True, True, lACPrint, True
    Else
        RSZero
        Mode = Find
    End If

    sbRS.Panels(2) = ""
    
    SetDataSource
    SetDataField

ErrorHandler:

    
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoAll
    End If

End Sub

Public Sub TBUndoCurrent()
On Error GoTo ErrorHandler

    GetChild
    If rsHeader.Status = adRecNew Then
        rsDetail.CancelBatch adAffectAll
        rsHeader.CancelUpdate
    Else
        rsHeader.CancelBatch adAffectCurrent
        rsDetail.CancelBatch adAffectAll
    End If
   
    If rsHeader.RecordCount = 0 Then RSZero
    
ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217842 Then
        TBUndoCurrent
    End If

End Sub

Public Sub TBSave()
Dim OKUpdate As Boolean
Dim lNew As Boolean
On Error GoTo ErrHandler

    lBoolean = False
    If rsHeader.Status = adRecNew Then lBoolean = True
    
    If Not MandatoryOK Then Exit Sub
    
    If rsHeader.Status = adRecNew Then

        If lSystemGenerated Then
            'If ChkCtrlNo(rsHeader, "AUTO_NUMBER_FAD", "FIXEDASSETDEPRE", "cTranNo", rsHeader!cTranNo) <> rsHeader!cTranNo Then
            If AutoNum.Check_CtrlNo2(rsHeader, "FIXEDASSETDEPRE", "cTranNo", rsHeader!cTranNo, MenuName, rsHeader!dDate) <> rsHeader!cTranNo Then
                
                GetChild
                
                rsHeader!cTranNo = strNo
                
                If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
                Do Until rsDetail.EOF
                    rsDetail!cTranNo = strNo
                    rsDetail.MoveNext
                Loop
                
                GetChild
            End If
        End If
    End If
    
    OKUpdate = False
    cn.BeginTrans
    connHeader.BeginTrans
    connDetail.BeginTrans
    
    Dim nValue As Integer
    
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.EOF

            cn.Execute ("UPDATE ASSET SET nLastDepre = nLastDepre + '" & Trim(rsDetail!nMoDepreciation) & "' ,  " & _
                "nBook = nBook - '" & Trim(rsDetail!nMoDepreciation) & "'  " & _
                "WHERE cAssetNo = '" & Trim$(rsDetail!cAssetID) & "' AND cCompanyID = '" & COID & "' ")
                
            rsDetail.MoveNext
        Loop
    End If
        
    rsHeader.UpdateBatch adAffectAll
    rsDetail.UpdateBatch adAffectAll
    
    
    cn.CommitTrans
    connHeader.CommitTrans
    connDetail.CommitTrans
    OKUpdate = True
    
    Set FrmName = Me
    FormLocking True
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , lACDelete, , , , lACCancel, , , True, True, , True
    Mode = Normal
    

    UpdateGLA "Update", "FAD", Trim(txtcTranNo)
    UpdateLogFile "Purchase Request", Trim(txtcTranNo), IIf(lBoolean, "Inserted", "Updated")

    If lBoolean Then
        If lSystemGenerated And strNo = rsHeader!cTranNo Then
            UpdateControlNo strNo, rsHeader!cTranNo, "AUTO_NUMBER_FAD"
            AutoNum.Update_CtrlNo2 strNo, MenuName, Format(Now, "mm/dd/yyyy")
        End If
    End If
    
    If lBoolean = False Then ' Edit
            cn.Execute ("UPDATE FIXEDASSETDEPRE SET  dUpdated = GETDATE() WHERE cTranNo = '" & Trim(txtcTranNo) & "' AND cCompanyID = '" & COID & "'")
    Else ' Insert
            cn.Execute ("UPDATE FIXEDASSETDEPRE SET  dUpdated = GETDATE() WHERE cTranNo = '" & Trim(txtcTranNo) & "' AND cCompanyID = '" & COID & "'")
    End If
    MsgBox "Record/s successfully saved.", vbInformation, msgTtl
    sbRS.Panels(2) = ""

    
ErrHandler:
    
    
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        OKUpdate = True
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        MsgBox "Record cannot be updated. Some values may have been changed by other user/s since last read." & vbCr & _
                "Records will be automatically refreshed. All changes made to the record will be gone upon refresh.", vbInformation, msgTtl
        vBookMark = rsHeader.Bookmark
        UnbindControls
        rsHeader.Requery
        rsDetail.Requery
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , lACDelete, , , , lACCancel, , , True, True, lACPrint, True
        Mode = Normal
        If rsHeader.RecordCount <> 0 Then
            Set FrmName = Me
            FormLocking True
            SetDataField
            SetDataSource
            rsHeader.Bookmark = vBookMark
        Else
            RSZero
        End If
    End If
    If Not OKUpdate Then
        MsgBox "Transaction update failed.", vbInformation, msgTtl
        cn.RollbackTrans
        connHeader.RollbackTrans
        connDetail.RollbackTrans
        ErrorLog err.Number, err.Description, Me.Name 'Error log
    End If
    
End Sub

Public Sub TBEdit()
    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Edit is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    Mode = AddNewEdit
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True
    Set FrmName = Me
    FormLocking False
    ClrRequired &HC0&
    txtcTranNo.Locked = True
    SSTab1.ActiveTab = 0
    dtbDate.SetFocus
    vBM = rsHeader.Bookmark
    
    MenuName = "AUTO_NUMBER_FAD"
    lSysTransDate = GetValueFrTable("lTransDate", "system_autonumber", "cCode = '" & MenuName & "' ") 'add by denz:2/17/2011
    If lSysTransDate Then
        dtbDate.Enabled = True
    Else: dtbDate.Enabled = False
    End If
End Sub

Public Sub TBDelete()
On Error GoTo ErrorHandler

    sID = Trim(txtcTranNo)
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled. Deletion is not allowed.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to delete this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub

    GetChild
    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.RecordCount = 0
        
            cn.Execute ("UPDATE ASSET SET nLastDepre = nLastDepre - '" & Trim(rsDetail!nMoDepreciation) & "' ,  " & _
            "nBook = nBook + '" & Trim(rsDetail!nMoDepreciation) & "'  " & _
            "WHERE cAssetNo = '" & Trim$(rsDetail!cAssetID) & "' AND cCompanyID = '" & COID & "' ")
                    
            rsDetail.Delete adAffectCurrent
            If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
        Loop
    End If

    UpdateGLA "Delete", "FAD", Trim(txtcTranNo)

    UpdateLogFile "Fixed Asset Depreciation", Trim(txtcTranNo), "Deleted"

    rsHeader.Delete adAffectCurrent
    
    rsDetail.UpdateBatch adAffectAll
    rsHeader.UpdateBatch adAffectAll

    TBPrevRec

    Mode = Normal

    If rsHeader.RecordCount = 0 Then
        RSZero
    End If

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    ElseIf err.Number = -2147217864 Then
        cn.Execute "DELETE FIXEDASSETDEPRE_T WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        cn.Execute "DELETE FIXEDASSETDEPRE WHERE cTranNo = '" & sID & "' AND cCompanyID = '" & COID & "'"
        Resume Next
    End If

End Sub

Public Sub TBFind()
    Mode = Normal
    txtcTranNo.Locked = True
    frmITGSearch.Show
End Sub

Public Sub TBFindPrimary()
Dim sTemp As String
If Mode = Find Then
    FormWaitShow App.Path & "\Transmit.avi", "Loading data . . ."
            
    OpenNewConnection connHeader
    OpenNewConnection connDetail
    
    Set rsHeader = Nothing
    Set rsDetail = Nothing
    Set rsHeader = New ADODB.Recordset
    Set rsDetail = New ADODB.Recordset

    sTemp = Trim$(GetSearchString)
    If sTemp = "ERROR" Then
        MsgBox "Only Allows A - Z, 0 - 9, '.', ',' and %(wildcard)", vbExclamation, ""
        BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
        txtcTranNo.Locked = False
        txtcTranNo.SetFocus
        Exit Sub
    End If
    
    OpenRecordsetWithCN rsHeader, "*", "FIXEDASSETDEPRE", connHeader, IIf(sTemp = "", "", " WHERE " & sTemp)
    'OpenRecordsetWithCN rsDetail, "*", "FIXEDASSETDEPRE_T", connDetail
   
    OpenRecordsetWithCN rsDetail, "*", "FIXEDASSETDEPRE_T", connDetail, IIf(sTemp = "", "", " WHERE cTranNo IN (SELECT cTranNo FROM FIXEDASSETDEPRE WHERE " & sTemp & ")")

    Set FrmName = Me
    FormLocking True

    If rsHeader.RecordCount = 0 Then
        FormWaitHide
        MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
        RSZero
        FormSearch True
        SearchObj True
        Mode = Find
        Exit Sub
    End If
    SetDataSource
    SetDataField
    txtcTranNo.BackColor = &HE0FFFF
    Mode = Normal
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , lACDelete, , , , lACCancel, , , True, True, , True

    FormWaitHide
Else
    RSZero
    FormSearch True
    SearchObj True
    Mode = Find
    
End If
    
End Sub

Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = True
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
    dtgName = dtgFixedAsset.Name
End Sub

Public Sub TBCloseWindow()
    Unload Me
End Sub

Public Sub TBFirstRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveFirst rsHeader
End Sub

Public Sub TBPrevRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MovePrevious rsHeader
End Sub

Public Sub TBNextRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveNext rsHeader
End Sub

Public Sub TBLastRec()
    If rsHeader.State <> adStateOpen Then Exit Sub
    MoveLast rsHeader
End Sub


Function check(DFrom As String, DTo As String) As Boolean
Dim rs1 As New ADODB.Recordset
rs1.CursorLocation = adUseClient
rs1.Open "SELECT * FROM FIXEDASSETDEPRE WHERE dTodate BETWEEN '" & DFrom & "' and '" & DTo & "'", cn, adOpenKeyset
If Not rs1.EOF Then
    check = True
Else
    check = False
End If
Set rs1 = Nothing
End Function

Public Sub TBNewLine()
Dim sqlss As String
    
    'Determine if RS is open...and then close it -dave
    'Replace old script to new one.
    If dtbTo.Text = "__/__/____" Or dtbFrom.Text = "__/__/____" Then
        MsgBox "From Date and To Date is Required.", vbExclamation, "Fixed Assets Depreciation"
        Exit Sub
    End If
    If dtbTo.Text = "__/__/____" Then Exit Sub
    If dtbFrom.Text > dtbTo.Text Then Exit Sub
    If rs.State = adStateOpen Then rs.Close
        If check(dtbFrom.Text, dtbTo.Text) Then
            MsgBox "The period you specified has been depreciated. ", vbInformation, "Fixed Assets Depreciation"
            Exit Sub
        End If
        sSQL = "select a.cAssetNo,a.cDesc,A.nDepre, A.cDepreAcct, A.cExpAcct, A.nBook " & _
               " from (select * from asset   where dDisposalDate is null)a " & _
               " Where A.nBook > 0 and A.cCompanyID = '" & Trim(COID) & "' and " & _
               "     a.dDisposalDate is null " & _
               "     and (a.dDepDate < '" & dtbFrom.Text & "' or a.dDepDate between '" & dtbFrom.Text & "' and '" & dtbTo.Text & "') " & _
               " Union All " & _
               " select a.cAssetNo,a.cDesc,A.nDepre, A.cDepreAcct, A.cExpAcct, A.nBook " & _
               " from asset a " & _
               " Where  A.nBook > 0 and A.cCompanyID = '" & Trim(COID) & "' and " & _
               "     ((not a.dDisposalDate < '" & dtbFrom.Text & "') and (a.dDisposalDate not between '" & dtbFrom.Text & "' and '" & dtbTo.Text & "')) and " & _
               "     (a.dDepDate < '" & dtbFrom.Text & "' or a.dDepDate between '" & dtbFrom.Text & "' and '" & dtbTo.Text & "') "


    
    
'        sSQL = "SELECT A.cAssetNo, A.cDesc, A.nDepre, A.cDepreAcct, A.cExpAcct, A.nBook  " & _
'                "FROM ASSET A WHERE (A.dDepDate < '" & dtbFrom.Text & "' or  A.dDepDate between '" & dtbFrom.Text & "' and '" & dtbTo.Text & "') and A.cCompanyID = '" & Trim(COID) & "' AND A.nBook <> 0 " & _
'                "AND A.cAssetNo NOT IN (SELECT B.cAssetNo FROM INTAR_A B, INTAR C WHERE A.cCompanyID = B.cCompanyID " & _
'                "AND B.cCompanyID = C.cCompanyID AND B.cTranNo = C.cTranNo AND C.lCancelled = 0)" & _
'                "ORDER BY A.cAssetNo "
                rs.Open sSQL, cn, adOpenKeyset

        sSQL = "SELECT cAssetNo, cDesc, nDepre, cDepreAcct, cExpAcct, nBook FROM ASSET WHERE cCompanyID = '" & Trim(COID) & "' AND nBook <> 0 ORDER BY cAssetNo "

        If rs.RecordCount <> 0 Then
            rs.MoveFirst
            Do Until rs.EOF
                rsDetail.AddNew
                rsDetail!cCompanyID = COID
                rsDetail!cTranNo = Trim(rsHeader!cTranNo)
                rsDetail!cAssetID = Trim(rs!cAssetNo)
                rsDetail!cDesc = Trim(rs!cDesc)
                If rs!nBook < rs!nDepre Then
                    rsDetail!nMoDepreciation = rs!nBook
                Else
                    rsDetail!nMoDepreciation = rs!nDepre
                End If
                rsDetail!cDepreAcct = Trim(rs!cDepreAcct)
                rsDetail!cExpAcct = Trim(rs!cExpAcct)
                rsDetail!cRemarks = ""
                rs.MoveNext
            Loop
            GetChild
        End If
        
        rs.Close
        Set rs = Nothing
  
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

End Sub

Public Sub TBDeleteLine()
On Error GoTo ErrorHandler

    If dtgName = dtgFixedAsset.Name Then
        If rsDetail.RecordCount = 0 Then Exit Sub
        vBookMark = dtgFixedAsset.Bookmark
        GetChild
        dtgFixedAsset.Bookmark = vBookMark
        rsDetail.Delete adAffectCurrent
    End If
    GetChild

    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , True, True, , , True, True, , , , True

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBUndoLineAll()
On Error GoTo ErrorHandler

    MsgBox "Unavailable on " & Me.Name

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBUndoLineCurrent()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBPostRecord()
    MsgBox "Unavailable on " & Me.Name
End Sub

Public Sub TBCancelRecord()
On Error GoTo ErrorHandler
    
    If rsHeader.RecordCount = 0 Then Exit Sub

    If rsHeader!lCancelled = True Then
        MsgBox "Transaction was already cancelled.", vbExclamation, msgTtl
        Exit Sub
    End If
    
    If MsgBox("Are you sure you want to cancel this record?", vbQuestion + vbYesNo, msgTtl) = vbNo Then Exit Sub

   ' If Not AllowDelete("cancel") Then Exit Sub

    UpdateLogFile "FIXED ASSET DEPRE", Trim(txtcTranNo), "Cancelled"

    cn.Execute ("UPDATE FIXEDASSETDEPRE SET lCancelled = 1 ,  dUpdated = GETDATE () WHERE cTranNo = '" & Trim(txtcTranNo) & "' AND cCompanyID = '" & COID & "'")
    
    sbRS.Panels(5) = "CANCELLED"
    Mode = Normal
    
    rsHeader!lCancelled = True
    rsHeader.UpdateBatch adAffectAll

ErrorHandler:
    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Public Sub TBPrintRecord()
    cModule = "FixedAsset_Depreciation"
    oPrint.PrintReceipt Trim(txtcTranNo)
End Sub

Sub SetDataSource()
    Set FrmName = Me
    BindControls rsHeader
    Set dtgList.DataSource = rsHeader
    Set dtgFixedAsset.DataSource = rsDetail
    
End Sub

Sub SetDataField()
    With rsHeader
        txtcTranNo.DataField = !cTranNo
        dtbDate.DataField = !dDate
        dtbFrom.DataField = !dFromDate
        dtbTo.DataField = !dToDate
        txtRemarks.DataField = txtcRemarks
        txtProject.DataField = !cProjectID
        txtWork.DataField = !cWorkID
    End With
End Sub


Private Sub rsHeader_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
On Error GoTo ErrorHandler

    If Not (rsHeader.EOF) Or Not (rsHeader.BOF) Then
    
        sbRS.Panels(1) = "Record: " & IIf((rsHeader.AbsolutePosition = -2), "0", rsHeader.AbsolutePosition) & "/" & rsHeader.RecordCount

        If rsHeader.Status <> adRecNew Then
            txtcTranNo.Locked = True
        Else
            txtcTranNo.Locked = False
        End If

        If Mode = AddNewEdit Then
            Select Case rsHeader.Status
                Case adRecNew
                    sbRS.Panels(2) = "New"
                Case adRecModified
                    sbRS.Panels(2) = "Modified"
                Case Else
                    sbRS.Panels(2) = ""
            End Select
        Else
            sbRS.Panels(2) = ""
        End If
        
        GetChild
        
        If rsHeader!lCancelled = True Then
            sbRS.Panels(5) = "CANCELLED"
        Else
            sbRS.Panels(5) = ""
        End If
    Else
        sbRS.Panels(1) = "Record: 0/0"
        sbRS.Panels(2) = ""
        txtcTranNo.Locked = False
    End If

    If Mode = AddNewEdit Then
        dtgFixedAsset.Refresh
    End If

ErrorHandler:

    If err.Number = -2147217885 Then
        Resume Next
    End If

End Sub

Private Sub Timer1_Timer()
    If Mode = AddNewEdit Then
        SSTab1.TabEnabled(1) = False
    Else
        SSTab1.TabEnabled(1) = True
    End If
End Sub

Function MandatoryOK() As Boolean
    
    MandatoryOK = True

    If Trim(txtcTranNo) = "" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Number' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        txtcTranNo.SetFocus
        Exit Function
    End If
    
    If rsHeader.Status = adRecNew And lSystemGenerated = False Then '
        If IDExisting(rsHeader, "cTranNo", "FIXEDASSETDEPRE", Trim(rsHeader!cTranNo)) Then
            MandatoryOK = False
            MsgBox "Transaction No. already exist.", vbInformation, msgTtl
            txtcTranNo.SetFocus
            Exit Function
        End If
    End If

    If Trim(dtbDate.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        dtbDate.SetFocus
        Exit Function
    ElseIf Trim(dtbFrom.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date From' is mandatory. Null value is not allowed. ", vbInformation, msgTtl
        dtbFrom.SetFocus
        Exit Function
    ElseIf Trim(dtbTo.Text) = "__/__/____" Then
        MandatoryOK = False
        MsgBox "Field 'Transaction Date To' is mandatory. Null value is not allowed.", vbInformation, msgTtl
        dtbTo.SetFocus
        Exit Function
    End If
    
    GetChild

    If rsDetail.RecordCount < 1 Then
        MandatoryOK = False
        MsgBox "Cannot save transaction without details.", vbInformation, msgTtl
        dtgFixedAsset.SetFocus
        Exit Function
    End If
    
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
        If rsDetail.Status = (adRecNew) Or rsDetail.Status = (adRecModified) Then
            If IsNull(rsDetail!cAssetID) Then
                rsDetail.Delete
            ElseIf Trim(rsDetail!cAssetID) = "" Then
                rsDetail.Delete
            Else
                rsDetail.MoveNext
            End If
        Else
            rsDetail.MoveNext
        End If
    Loop

    GetChild

    If rsDetail.RecordCount < 1 Then
        MsgBox "Cannot save transaction without details.", vbExclamation, msgTtl
        MandatoryOK = False
        Exit Function
    End If

    If rsDetail.RecordCount <> 0 Then
        rsDetail.MoveFirst
        Do Until rsDetail.EOF
            rsDetail!nIdentity = rsDetail.AbsolutePosition
            rsDetail.MoveNext
        Loop
    End If
    
End Function

Private Sub GetChild()
    rsDetail.Filter = "cTranNo = '" & Trim(rsHeader!cTranNo) & "' "
End Sub

Private Sub RSZero()
    sbRS.Panels(1) = "Record: 0/0"
    sbRS.Panels(2) = ""
    sbRS.Panels(4) = ""
    sbRS.Panels(5) = ""
    
    Set dtgFixedAsset.DataSource = Nothing
    dtgFixedAsset.Refresh
    
    Set FrmName = Me
    UnbindControls
    TextClearing
    FormLocking True
    
    If rsHeader.State = adStateOpen Then rsHeader.Close
    If rsDetail.State = adStateOpen Then rsDetail.Close
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, , , , , , , , , True, , , True
    
    txtcTranNo.Locked = False
    txtcTranNo.SetFocus
    
    Mode = Find
    
End Sub

Sub SearchObj(lEnable As Boolean)
    dtbDate.Enabled = lEnable
    dtbFrom.Enabled = lEnable
    dtbTo.Enabled = lEnable
    cmdPickProject.Enabled = lEnable
    cmdPickWork.Enabled = lEnable
End Sub

Private Sub GetInitialItemValues(RefRS As Recordset)
    RefRS!cDesc = Trim(GetValueFrTable("cDesc", "ASSET", "cAssetNo = '" & Trim(RefRS!cAssetID) & "' ")) & ""
    RefRS!nMoDepreciation = GetValueFrTable("nDepre", "ASSET", "cAssetNo = '" & Trim(RefRS!cAssetID) & "' ")
    RefRS!cDepreAcct = Trim(GetValueFrTable("cDepreAcct", "ASSET", "cAssetNo = '" & Trim(RefRS!cAssetID) & "' "))
    RefRS!cExpAcct = Trim(GetValueFrTable("cExpAcct", "ASSET", "cAssetNo = '" & Trim(RefRS!cAssetID) & "' "))
End Sub
Private Function GetSearchString() As String
On Error GoTo ErrorHandler
Dim sWhere As String

    GetSearchString = True

    If Trim$(txtcTranNo.Text) <> "" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " cTranNo LIKE '" & Trim$(txtcTranNo.Text) & "%'"
    End If

    If Trim$(dtbDate.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dDate = '" & Trim$(dtbDate.Text) & "'"
    End If
    
    If Trim$(dtbFrom.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dFromDate = '" & Trim$(dtbFrom.Text) & "'"
    End If
    
    If Trim$(dtbTo.Text) <> "__/__/____" Then
        sWhere = sWhere & IIf(Trim$(sWhere) = "", "", " AND ") & " dToDate = '" & Trim$(dtbTo.Text) & "'"
    End If
    
    GetSearchString = Trim$(sWhere)

    Exit Function
ErrorHandler:
    GetSearchString = "ERROR"
End Function

Private Sub txtcRemarks_Change()
    txtRemarks = Trim(txtcRemarks)
End Sub

Private Sub txtcTranNo_LostFocus()
    If Mode = AddNewEdit Then
        If Trim(txtcTranNo) = "" Then
            MsgBox "Empty primary input.", vbInformation, msgTtl
            If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
            txtcTranNo.SetFocus
        Else
            If rsHeader.Status <> adRecNew Then Exit Sub
            txtcTranNo = Trim(txtcTranNo)
            If IDExisting(rsHeader, "cTranNo", "FIXEDASSETDEPRE", Trim(rsHeader!cTranNo)) Then
                MsgBox "Transaction No. already exist.", vbInformation, msgTtl
                If FrmName.Name <> Me.Name Then PreviousTab frmComUnionMenuTab
                txtcTranNo.SetFocus
            End If
        End If
    End If
End Sub

Private Sub txtRemarks_KeyPress(KeyAscii As Integer)
    KeyAscii = Asc(UCase(Chr(KeyAscii)))
End Sub

Private Sub txtRemarks_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If rsDetail.RecordCount = 0 Then TBNewLine
End Sub

Private Function AllowEdit() As Boolean

End Function

Private Function AllowDelete(sAction As String) As Boolean

End Function

Sub ChangeTranNo(strTranNo As String)
    GetChild
    
    rsHeader!cTranNo = strTranNo
    If rsDetail.RecordCount <> 0 Then rsDetail.MoveFirst
    Do Until rsDetail.EOF
        rsDetail!cTranNo = strTranNo
        rsDetail.MoveNext
    Loop
    
    GetChild
End Sub
Public Sub ShowForm(sTranNo As String)
    If Mode = Find Then

        OpenNewConnection connHeader
        OpenNewConnection connDetail

        Set rsHeader = Nothing
        Set rsDetail = Nothing
        Set rsHeader = New ADODB.Recordset
        Set rsDetail = New ADODB.Recordset

        OpenRecordsetWithCN rsDetail, "*", "FIXEDASSETDEPRE_T", connDetail, "WHERE cTranNo = '" & Trim(sTranNo) & "'"
        OpenRecordsetWithCN rsHeader, "*", "FIXEDASSETDEPRE", connHeader, "WHERE cTranNo = '" & Trim(sTranNo) & "'"

        Set FrmName = Me
        FormLocking True

        If rsHeader.RecordCount = 0 Then
            FormWaitHide
            MsgBox "No matching record/s found.", vbInformation, "ComUnion Search"
            RSZero
            FormSearch True
            SearchObj True
            Mode = Find
            Exit Sub
        End If
            SetDataSource
            SetDataField
            txtcTranNo.BackColor = &HE0FFFF
            Mode = Normal
            BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , lACCancel, , , True, True, lACPrint, True

            'BitEnabled Me, ITGLedgerMain.tbrMain, lACNew, lACEdit, lACDelete, , , , , , , True, True, , True, True

    End If
End Sub


Private Sub txtProject_Change()
    txtProjectName = ""
    txtProjectName = GetValueFrTable("cProjectName", "Project_Maintenance", "cProjectNo = '" & Trim(txtProject) & "'")
End Sub


Private Sub txtProject_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtProject) = "" And Trim(txtProject) <> "" Then cmdPickProject_Click
End Sub

Private Sub cmdPickProject_Click()
    If lPickListActive Then Exit Sub
    sFilterString = Trim(txtProject)
    frmITGPicker.zType = QProject
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "'"
    
    frmITGPicker.Show vbModal
    txtProject = frmITGPicker.zCode
    txtProjectName = frmITGPicker.zName
    If Trim(txtProjectName) <> "" Then SendKeys "{Tab}"
End Sub


Private Sub txtWork_Change()
    txtWorkDesc = ""
    If txtProject.Text = "" Then: txtProject.SetFocus: Exit Sub
    txtWorkDesc = GetValueFrTable("description", "Work_Maintenance_File", "workno = '" & Trim(txtWork) & "' ") 'and cProjectNo =  '" & Trim(txtProject) & "'")
End Sub


Private Sub cmdPickWork_Click()
    If lPickListActive Then Exit Sub
'    sFilterString = Trim(txtWork)
    frmITGPicker.zType = QWork
    frmITGPicker.Condition = "where cCompanyID = '" & COID & "' " 'and cProjectNo = '" & Trim(txtProject) & "'"
    
    frmITGPicker.Show vbModal
    txtWork = frmITGPicker.zCode
    txtWorkDesc = frmITGPicker.zName
    If Trim(txtWorkDesc) <> "" Then SendKeys "{Tab}"
End Sub


Private Sub txtWork_LostFocus()
    If Mode <> AddNewEdit Then Exit Sub
    If Trim(txtWork) = "" And Trim(txtWork) <> "" Then cmdPickWork_Click
End Sub
